package com.zhuo.project.order.service.impl;

import java.util.List;
import com.zhuo.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.zhuo.project.order.mapper.ZzTaskMapper;
import com.zhuo.project.order.domain.ZzTask;
import com.zhuo.project.order.service.IZzTaskService;

/**
 * AdEcom任务Service业务层处理
 * 
 * @author zhuo
 * @date 2020-03-26
 */
@Service
public class ZzTaskServiceImpl implements IZzTaskService 
{
    @Autowired
    private ZzTaskMapper zzTaskMapper;

    /**
     * 查询AdEcom任务
     * 
     * @param id AdEcom任务ID
     * @return AdEcom任务
     */
    @Override
    public ZzTask selectZzTaskById(Long id)
    {
        return zzTaskMapper.selectZzTaskById(id);
    }

    /**
     * 查询AdEcom任务列表
     * 
     * @param zzTask AdEcom任务
     * @return AdEcom任务
     */
    @Override
    public List<ZzTask> selectZzTaskList(ZzTask zzTask)
    {
        return zzTaskMapper.selectZzTaskList(zzTask);
    }

    @Override
    public List<ZzTask> selectZzTaskListByType(Integer taskType) {

        return zzTaskMapper.selectZzTaskListByType(taskType);
    }

    /**
     * 新增AdEcom任务
     * 
     * @param zzTask AdEcom任务
     * @return 结果
     */
    @Override
    @Transactional(rollbackFor = Exception.class)
    public int insertZzTask(ZzTask zzTask)
    {
        zzTask.setCreateTime(DateUtils.getNowDate());
        return zzTaskMapper.insertZzTask(zzTask);
    }

    /**
     * 修改AdEcom任务
     * 
     * @param zzTask AdEcom任务
     * @return 结果
     */
    @Override
    @Transactional(rollbackFor = Exception.class)
    public int updateZzTask(ZzTask zzTask)
    {
        zzTask.setUpdateTime(DateUtils.getNowDate());
        return zzTaskMapper.updateZzTask(zzTask);
    }

    /**
     * 批量删除AdEcom任务
     * 
     * @param ids 需要删除的AdEcom任务ID
     * @return 结果
     */
    @Override
    @Transactional(rollbackFor = Exception.class)
    public int deleteZzTaskByIds(Long[] ids)
    {
        return zzTaskMapper.deleteZzTaskByIds(ids);
    }

    /**
     * 删除AdEcom任务信息
     * 
     * @param id AdEcom任务ID
     * @return 结果
     */
    @Override
    @Transactional(rollbackFor = Exception.class)
    public int deleteZzTaskById(Long id)
    {
        return zzTaskMapper.deleteZzTaskById(id);
    }
}
